﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLayer;

namespace PresentationLayer
{
    public partial class AdicDepartamentoFunc : Form
    {
        public AdicDepartamentoFunc()
        {
            InitializeComponent();
        }

        private void buttonDepFunc_Click(object sender, EventArgs e)
        {
            this.textBoxIDDep.SelectAll();
            this.textBoxIDFunc.SelectAll();
            this.textBoxIDOfic.SelectAll();
            String dep, func, ofic;
            if ((dep =this.textBoxIDDep.SelectedText) == "" || (func = this.textBoxIDFunc.SelectedText) == "" || 
                (ofic=this.textBoxIDOfic.SelectedText) == "")
            {
                MessageBox.Show("Todos os dados são obrigatórios");
                return;
            }

            if (FuncionarioActions.AlterarFuncionario(func, dep, ofic))
                this.Close();
            else MessageBox.Show("Verifique os dados ");
        }
    }
}
